//

// reply.cpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include "request.hpp"
#include <string>
#include <boost/lexical_cast.hpp>
#include "connection.hpp"
#include <iostream>


namespace http {
    namespace server3 {


        bool request::get_header_value(const std::string header_str, std::string& header_value_str)
        {
            std::vector<header>::iterator it;
            for ( it = headers.begin(); it < headers.end(); it++ )
            {
                if(it->name.compare(header_str) == 0 )
                {
                    header_value_str = it->value;
                    return true;
                }
            }
            return false;

        }

        void request::add_header(const std::string &name_, const std::string &value_)
		{
			header header_;
			header_.name = name_;
			header_.value = value_;
			headers.push_back(header_);
		}
		void request::reset()
		{
			connection_id = 0;
            method.clear();
            uri.clear();
			http_version_major=0;
			http_version_minor=0;
            headers.clear();
        }        

    } // namespace server3
} // namespace http	
